package com.task.scheduler.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 统一配置类，包含 Redisson 和任务持久化相关配置
 */
@Data
@Component
@ConfigurationProperties(prefix = "task.scheduler")
public class TaskSchedulerProperties {

    /**
     * Redisson 配置
     */
    private Redisson redisson = new Redisson();

    @Data
    public static class Redisson {
        private String host;
        private int port;
        private String password;
    }

    /**
     * 任务持久化配置
     */
    private Persistence persistence = new Persistence();

    @Data
    public static class Persistence {
        private boolean enabled = false;

        private DataSource datasource = new DataSource();
    }

    @Data
    public static class DataSource {
        private String url;
        private String username;
        private String password;
        private String driverClassName;
    }
}
